/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package jpa;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author Fredy
 */
@Entity
@Table(name = "dominioGeometrico")
@NamedQueries({@NamedQuery(name = "DominioGeometrico.findAll", query = "SELECT d FROM DominioGeometrico d"), @NamedQuery(name = "DominioGeometrico.findByIdDominioGeometrico", query = "SELECT d FROM DominioGeometrico d WHERE d.idDominioGeometrico = :idDominioGeometrico"), @NamedQuery(name = "DominioGeometrico.findByTipo", query = "SELECT d FROM DominioGeometrico d WHERE d.tipo = :tipo")})
public class DominioGeometrico implements Serializable {
    private static final long serialVersionUID = 1L;


    @Id
    @Basic(optional = false)
    @Column(name = "idDominioGeometrico", nullable = false)
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Integer idDominioGeometrico;

    @Column(name = "tipo")
    private String tipo;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idDominioGeometrico")
    private Collection<ConjuntoS> conjuntoSCollection;
    //@OneToMany(cascade = CascadeType.ALL, mappedBy = "idDominioGeometrico")
    //private Collection<ConjuntoP> conjuntoPCollection;
    @JoinColumn(name = "idEvaluacionDominio", referencedColumnName = "idEvaluacionDominio")
    @ManyToOne(optional = false)
    private EvaluacionDominio idEvaluacionDominio;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idDominioGeometrico")
    private Collection<Grilla> grillaCollection;

    public DominioGeometrico() {
    }

    public DominioGeometrico(Integer idDominioGeometrico) {
        this.idDominioGeometrico = idDominioGeometrico;
    }

    public Integer getIdDominioGeometrico() {
        return idDominioGeometrico;
    }

    public void setIdDominioGeometrico(Integer idDominioGeometrico) {
        this.idDominioGeometrico = idDominioGeometrico;
    }

    public String getTipo() {
        return tipo;
    }

    public void setTipo(String tipo) {
        this.tipo = tipo;
    }

    public Collection<ConjuntoS> getConjuntoSCollection() {
        return conjuntoSCollection;
    }

    public void setConjuntoSCollection(Collection<ConjuntoS> conjuntoSCollection) {
        this.conjuntoSCollection = conjuntoSCollection;
    }

    /*
    public Collection<ConjuntoP> getConjuntoPCollection() {
        return conjuntoPCollection;
    }


    public void setConjuntoPCollection(Collection<ConjuntoP> conjuntoPCollection) {
        this.conjuntoPCollection = conjuntoPCollection;
    }
     */

    public EvaluacionDominio getIdEvaluacionDominio() {
        return idEvaluacionDominio;
    }

    public void setIdEvaluacionDominio(EvaluacionDominio idEvaluacionDominio) {
        this.idEvaluacionDominio = idEvaluacionDominio;
    }

    public Collection<Grilla> getGrillaCollection() {
        return grillaCollection;
    }

    public void setGrillaCollection(Collection<Grilla> grillaCollection) {
        this.grillaCollection = grillaCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idDominioGeometrico != null ? idDominioGeometrico.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof DominioGeometrico)) {
            return false;
        }
        DominioGeometrico other = (DominioGeometrico) object;
        if ((this.idDominioGeometrico == null && other.idDominioGeometrico != null) || (this.idDominioGeometrico != null && !this.idDominioGeometrico.equals(other.idDominioGeometrico))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "jpa.DominioGeometrico[idDominioGeometrico=" + idDominioGeometrico + "]";
    }

}
